﻿@model EditForumPostModel
@using Grand.Core.Domain.Forums;
@using Grand.Web.Models.Boards;
@inject IWebHelper webHelper;
@await Component.InvokeAsync("ForumBreadcrumb", new { forumTopicId = Model.ForumTopicId })

<div class="page forum-edit-page">
        @if (Model.IsEdit)
        {
            <h1 class="generalTitle">@T("Forum.EditPost")</h1>
        }
        else
        {
            <h1 class="generalTitle">@T("Forum.NewPost")</h1>
        }
        <div asp-validation-summary="ModelOnly" class="message-error"></div>
        <input asp-for="Id" type="hidden" />
        <input asp-for="ForumTopicId" type="hidden" />
        <div class="card">
            <div class="card-header">
                <div class="d-flex flex-column flex-md-row">
                    <label class="col-md-3 col-12">@T("Forum.ForumName"):</label>
                    <div class="col-md col-12">
                        <strong class="forum-subject">@Model.ForumName</strong>
                    </div>
                </div>
                <div class="d-flex flex-column flex-md-row">
                    <label class="col-md-3 col-12">@T("Forum.TopicTitle"):</label>
                    <div class="col-md col-12">
                        <strong class="topic-subject">@Model.ForumTopicSubject</strong>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <div class="form-group">
                    @if (Model.ForumEditor == EditorType.BBCodeEditor)
                    {
                        <div class="col-12 text-sm-right">
                            @Html.BBCodeEditor(webHelper, "Text")
                        </div>
                    }
                    <textarea asp-for="Text" class="form-control card-text" ></textarea>
                    <span asp-validation-for="Text"></span>
                </div>
                @if (Model.IsCustomerAllowedToSubscribe)
                {
                <fieldset class="form-group">
                    <label class="custom-control custom-checkbox">
                        <input class="custom-control-input" id="Subscribed" type="checkbox" name="Subscribed" value="true" @(Model.Subscribed ? Html.Raw("checked") : Html.Raw("")) />
                        <span class="custom-control-label"></span>
                        <span class="custom-control-description">@T("Forum.NotifyWhenSomeonePostsInThisTopic")</span>
                    </label>
                </fieldset>
                }
            </div>
        </div>
        <div class="btn-group mb-1 mt-1">
            <input type="submit" value="@T("Forum.Submit")" class="btn btn-secondary submit-post-button" />
            <input type="button" class="btn btn-secondary cancel-post-button" value="@T("Forum.Cancel")" onclick="setLocation('@Url.RouteUrl("TopicSlug", new { id = Model.ForumTopicId, slug = Model.ForumTopicSeName })')" />
        </div>
</div>
